﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns:local="clr-namespace:Microsoft.PlayerFramework"
  >
    <SolidColorBrush x:Key="TransportBackgroundBrush" Color="#80000000"/>
    <SolidColorBrush x:Key="TransportReversedBackgroundBrush" Color="#80FFFFFF"/>
    <sys:Double x:Key="SliderTrackThemeHeight">12</sys:Double>

    <!-- WP8 predefined resources -->
    <Color x:Key="PhoneProgressBarBackgroundColor">#19FFFFFF</Color>
    <SolidColorBrush x:Key="PhoneProgressBarBackgroundBrush" Color="{StaticResource PhoneProgressBarBackgroundColor}"/>
    <FontFamily x:Key="PhoneFontFamilyBold">Segoe WP Bold</FontFamily>
    <Color x:Key="PhoneButtonBasePressedForegroundColor">#FFFFFFFF</Color>
    <!-- WP8 predefined resources -->

    <Style x:Key="PrimaryButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="RootGrid" Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OutlineEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="BackgroundEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransportReversedBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OutlineEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Viewbox Margin="{TemplateBinding Padding}">
                            <Grid Height="40" Width="40">
                                <Ellipse x:Name="BackgroundEllipse" Fill="{StaticResource TransportBackgroundBrush}" UseLayoutRounding="False"/>
                                <Ellipse x:Name="OutlineEllipse" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" UseLayoutRounding="False"/>
                                <ContentControl x:Name="Content" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TransportBarButtonStyle" TargetType="Button">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="RootGrid" Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OutlineEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="BackgroundEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OutlineEllipse">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Viewbox Margin="{TemplateBinding Padding}">
                            <Grid Height="40" Width="40">
                                <Ellipse x:Name="BackgroundEllipse" Fill="{TemplateBinding Background}" UseLayoutRounding="False"/>
                                <Ellipse x:Name="OutlineEllipse" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" UseLayoutRounding="False"/>
                                <ContentControl x:Name="Content" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TransportBarTextButtonStyle" TargetType="Button">
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="FontSize" Value="22"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="MinWidth" Value="70"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="local:MediaControls.IsToolTipEnabled" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid ToolTipService.ToolTip="{TemplateBinding AutomationProperties.Name}" Background="#00000000" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:VolumeSlider">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VolumeSlider">
                    <local:SeekableSlider x:Name="Slider" SmallChange=".05" Orientation="{TemplateBinding Orientation}" Maximum="1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:VolumeButton">
        <Setter Property="PanelPosition" Value="-8,-124,-8,8"/>
        <Setter Property="Padding" Value="0,15,0,0"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="PanelBackground" Value="{StaticResource PhoneSemitransparentColor}" />
        <Setter Property="AutomationProperties.ItemType" Value="MediaPlayer Button"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VolumeButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="VolumeVisibilityStates">
                                <VisualState x:Name="VolumeRequested">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="VolumeSliderContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VolumeSliderContainer">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="VolumeDismissed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="VolumeSliderContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VolumeSliderContainer">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="VolumeHidden">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="VolumeSliderContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VolumeSliderContainer">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="VolumeVisible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="VolumeSliderContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VolumeSliderContainer">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Button x:Name="MuteButton" Style="{TemplateBinding MuteButtonStyle}">
                            <local:MediaControls.Behavior>
                                <local:MuteButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Grid x:Name="VolumeSliderContainer" VerticalAlignment="Top">
                            <Border Margin="{TemplateBinding PanelPosition}" Background="{TemplateBinding PanelBackground}">
                                <local:VolumeSlider x:Name="VolumeSlider" ViewModel="{TemplateBinding ViewModel}" Width="{StaticResource SliderTrackThemeHeight}" Orientation="Vertical" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:SignalStrength">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Maximum" Value="1"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SignalStrength">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SignalStrengthStates">
                                <VisualState x:Name="None">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="glyph" Storyboard.TargetProperty="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value=""/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Low">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="glyph" Storyboard.TargetProperty="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value=""/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Medium">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="glyph" Storyboard.TargetProperty="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value=""/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="High">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="glyph" Storyboard.TargetProperty="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value=""/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Full">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="glyph" Storyboard.TargetProperty="Text">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value=""/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <TextBlock x:Name="glyph" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Text=""/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ResolutionIndicator">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Foreground" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeSmall}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyBold}"/>
        <Setter Property="Width" Value="30"/>
        <Setter Property="Height" Value="19"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ResolutionIndicator">
                    <Border Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}" CornerRadius="3">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="MediaQuality">
                                <VisualState x:Name="SD">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HighDefinition" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="StandardDefinition" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="HD"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <TextBlock x:Name="HighDefinition" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="HD" Visibility="Visible"/>
                            <TextBlock x:Name="StandardDefinition" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Text="SD" Visibility="Collapsed"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Button" x:Key="VisualMarkerStyle">
        <Setter Property="Width" Value="25"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="Padding" Value="11,0,11,0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Glyph" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Glyph" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Glyph" Margin="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Foreground}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DeselectableListBox">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DeselectableListBox">
                    <local:ParentAwareListBox x:Name="ListBox" Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding Background}" Tag="{TemplateBinding SelectedIdentifierText}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="local:ParentAwareListBoxItem">
                                <Setter Property="Background" Value="Transparent" />
                                <Setter Property="TabNavigation" Value="Local" />
                                <Setter Property="Padding" Value="8,10" />
                                <Setter Property="HorizontalContentAlignment" Value="Left" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="local:ParentAwareListBoxItem">
                                            <Border x:Name="LayoutRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver"/>
                                                        <VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="Foreground">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckIdentifier" Storyboard.TargetProperty="Foreground">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledColor}" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                    <VisualStateGroup x:Name="SelectionStates">
                                                        <VisualState x:Name="Unselected">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIdentifier"/>
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Selected"/>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Grid Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}"/>
                                                    <TextBlock x:Name="CheckIdentifier" Foreground="{TemplateBinding Foreground}" Text="{Binding ParentListBox.Tag, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1"/>
                                                </Grid>
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </local:ParentAwareListBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="PhoneSimpleRepeatButton" TargetType="RepeatButton">
        <Rectangle Fill="Transparent"/>
    </ControlTemplate>
    
    <ControlTemplate x:Key="SeekableSliderTemplate" TargetType="local:SeekableSlider">
        <Grid x:Name="LayoutRoot">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver"/>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/>
                            <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="VerticalTrack"/>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="VerticalFill">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="ScrubbingStates">
                    <VisualState x:Name="NotScrubbing" />
                    <VisualState x:Name="Scrubbing" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>

            <Grid x:Name="HorizontalTemplate">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="12"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="HorizontalBackgroundContentPresenter" Grid.ColumnSpan="3" Margin="{TemplateBinding Padding}" Content="{TemplateBinding HorizontalBackgroundContent}"/>
                <Rectangle x:Name="HorizontalTrack" Grid.ColumnSpan="3" Margin="{TemplateBinding Padding}" Fill="{TemplateBinding Background}" IsHitTestVisible="False"/>
                <Rectangle x:Name="HorizontalFill" Margin="{TemplateBinding Padding}" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False"/>
                <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource PhoneSimpleRepeatButton}"/>
                <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource PhoneSimpleRepeatButton}"/>
                <Border x:Name="HorizontalAvailableBar" Grid.ColumnSpan="3" HorizontalAlignment="Left" IsHitTestVisible="True" Background="#00000000" />
                <ContentPresenter x:Name="HorizontalForegroundContentPresenter" Grid.ColumnSpan="3" Margin="{TemplateBinding Padding}" Content="{TemplateBinding HorizontalForegroundContent}"/>
                <Thumb x:Name="HorizontalThumb" Grid.Column="1" VerticalAlignment="Stretch" Style="{TemplateBinding SliderThumbStyle}" Background="{TemplateBinding SliderThumbBackground}" DataContext="{TemplateBinding Value}"/>
            </Grid>

            <Grid x:Name="VerticalTemplate">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="12"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <ContentPresenter x:Name="VerticalBackgroundContentPresenter" Margin="{TemplateBinding Padding}" Content="{TemplateBinding VerticalBackgroundContent}"/>
                <Rectangle x:Name="VerticalTrack" Grid.RowSpan="3" Margin="{TemplateBinding Padding}" Fill="{TemplateBinding Background}" IsHitTestVisible="False"/>
                <Rectangle x:Name="VerticalFill" Margin="{TemplateBinding Padding}" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False"/>
                <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource PhoneSimpleRepeatButton}"/>
                <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource PhoneSimpleRepeatButton}"/>
                <Border x:Name="VerticalAvailableBar" Grid.RowSpan="2" VerticalAlignment="Bottom" IsHitTestVisible="True" Background="#00000000" />
                <ContentPresenter x:Name="VerticalForegroundContentPresenter" Margin="{TemplateBinding Padding}" Content="{TemplateBinding VerticalForegroundContent}"/>
                <Thumb x:Name="VerticalThumb" Grid.Row="1" HorizontalAlignment="Stretch" Style="{TemplateBinding SliderThumbStyle}" Background="{TemplateBinding SliderThumbBackground}" DataContext="{TemplateBinding Value}"/>
            </Grid>
        </Grid>
    </ControlTemplate>

    <Style TargetType="local:SeekableSlider">
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Background" Value="{StaticResource PhoneProgressBarBackgroundColor}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="SliderThumbBackground" Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="Template" Value="{StaticResource SeekableSliderTemplate}"/>
        <Setter Property="SliderThumbStyle">
            <Setter.Value>
                <Style TargetType="Thumb">
                    <Setter Property="BorderThickness" Value="0" />
                    <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Thumb">
                                <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:Timeline">
        <Setter Property="Height" Value="{StaticResource SliderTrackThemeHeight}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Margin" Value="8,0,8,0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SliderTemplate" Value="{StaticResource SeekableSliderTemplate}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:Timeline">
                    <Grid>
                        <local:SeekableSlider x:Name="ProgressSlider"
                                Template="{TemplateBinding SliderTemplate}"
                                SmallChange="10"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Padding="{TemplateBinding Padding}"
                                VerticalAlignment="Stretch"
                                Orientation="Horizontal"
                                Height="{TemplateBinding Height}"
                                DataContext="{TemplateBinding ViewModel}">
                            <local:SeekableSlider.HorizontalForegroundContent>
                                <local:PositionedItemsControl x:Name="PositionedItemsControl"
                                    ItemsSource="{Binding VisualMarkers}"
                                    Minimum="{Binding StartTime.TotalSeconds}"
                                    Maximum="{Binding EndTime.TotalSeconds}">
                                    <local:PositionedItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Button IsEnabled="{Binding IsSeekable}"
                                            local:PositionedItemsPanel.Position="{Binding Time.TotalSeconds}"
                                            Content="{Binding Text}">
                                                <Button.Style>
                                                    <Binding Path="Style" ConverterParameter="{StaticResource VisualMarkerStyle}">
                                                        <Binding.Converter>
                                                            <local:TargetNullValueConverter/>
                                                        </Binding.Converter>
                                                    </Binding>
                                                </Button.Style>
                                            </Button>
                                        </DataTemplate>
                                    </local:PositionedItemsControl.ItemTemplate>
                                </local:PositionedItemsControl>
                            </local:SeekableSlider.HorizontalForegroundContent>
                            <local:SeekableSlider.HorizontalBackgroundContent>
                                <ProgressBar x:Name="DownloadProgressBar"
                                     VerticalAlignment="Stretch"
                                     Foreground="{StaticResource PhoneProgressBarBackgroundBrush}"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     Maximum="1"
                                     IsTabStop="False"
                                     BorderBrush="Transparent"
                                     IsIndeterminate="False"
                                     Value="{Binding DownloadProgress}">
                                    <ProgressBar.Template>
                                        <ControlTemplate TargetType="ProgressBar">
                                            <Grid>
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Determinate"/>
                                                        <VisualState x:Name="Indeterminate"/>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Grid x:Name="DeterminateRoot" Visibility="Visible">
                                                    <Rectangle x:Name="ProgressBarTrack" Fill="{TemplateBinding Background}"/>
                                                    <Rectangle x:Name="ProgressBarIndicator" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left"/>
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
                                    </ProgressBar.Template>
                                </ProgressBar>
                            </local:SeekableSlider.HorizontalBackgroundContent>
                        </local:SeekableSlider>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ControlPanelTemplate" TargetType="local:ControlPanel">
        <Grid VerticalAlignment="Bottom">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="MediaStates">
                    <VisualState x:Name="Opening"/>
                    <VisualState x:Name="Paused"/>
                    <VisualState x:Name="Playing"/>
                    <VisualState x:Name="Closed"/>
                    <VisualState x:Name="Buffering"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="LayoutStates">
                    <VisualState x:Name="Compact"/>
                    <VisualState x:Name="Normal"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="Orientation">
                    <VisualState x:Name="Landscape"/>
                    <VisualState x:Name="Portrait"/>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>

            <Border x:Name="Border" DataContext="{TemplateBinding ViewModel}" Background="{TemplateBinding Background}">
                <Border.Resources>
                    <local:BoolToVisibilityConverter x:Key="VisibleIfConverter" />
                </Border.Resources>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Right" Margin="0,10,10,10">
                        <Button x:Name="ReplayButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsReplayButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:ReplayButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="StopButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsStopButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:StopButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="SlowMotionButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsSlowMotionButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:SlowMotionButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="CaptionSelectionButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsCaptionSelectionButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:CaptionSelectionButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="AudioSelectionButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsAudioSelectionButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:AudioSelectionButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="ZoomButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsZoomButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="5,5,5,5">
                            <local:MediaControls.Behavior>
                                <local:ZoomButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="GoLiveButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsGoLiveButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:GoLiveButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="InfoButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsInfoButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:InfoButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="FullScreenButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsFullScreenButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:FullScreenButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="MuteButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsMuteButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:MuteButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                        <Button x:Name="MoreButton" Style="{TemplateBinding TransportBarButtonStyle}" Visibility="{Binding IsMoreButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                            <local:MediaControls.Behavior>
                                <local:MoreButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">

                        <StackPanel Orientation="Horizontal" x:Name="NonEssentialsNearLeft">
                            <Button x:Name="SkipPreviousButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsSkipPreviousButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:SkipPreviousButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                            <Button x:Name="RewindButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsRewindButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:RewindButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                            <Button x:Name="SkipBackButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsSkipBackButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:SkipBackButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                        </StackPanel>

                        <Button x:Name="PlayPauseButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsPlayPauseButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="50,0,50,0">
                            <local:MediaControls.Behavior>
                                <local:PlayPauseButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </Button>

                        <StackPanel Orientation="Horizontal" x:Name="NonEssentialsNearRight">
                            <Button x:Name="SkipAheadButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsSkipAheadButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:SkipAheadButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                            <Button x:Name="FastForwardButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsFastForwardButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:FastForwardButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                            <Button x:Name="SkipNextButton" Style="{TemplateBinding TransportBarButtonStyle}" Width="70" Height="70" Visibility="{Binding IsSkipNextButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Margin="10,0,10,0">
                                <local:MediaControls.Behavior>
                                    <local:SkipNextButtonBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                                </local:MediaControls.Behavior>
                            </Button>
                        </StackPanel>

                    </StackPanel>

                    <local:Timeline x:Name="Timeline" Grid.Row="2" ViewModel="{TemplateBinding ViewModel}" Visibility="{Binding IsTimelineVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}" Height="25" Padding="0,10,0,10" Margin="10,20,10,0"/>

                    <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Left" Margin="10,5,10,5">
                        <TextBlock x:Name="TimeElapsed" Visibility="{Binding IsTimeElapsedButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}">
                            <local:MediaControls.Behavior>
                                <local:TimeElapsedBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </TextBlock>
                        <TextBlock Text=" / " VerticalAlignment="Center" FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="{StaticResource PhoneFontFamilyNormal}"/>
                        <TextBlock x:Name="TimeRemaining" Visibility="{Binding IsTimeRemainingButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}">
                            <local:MediaControls.Behavior>
                                <local:TimeRemainingBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </TextBlock>
                        <TextBlock x:Name="TotalDuration" Visibility="{Binding IsDurationButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}">
                            <local:MediaControls.Behavior>
                                <local:TotalDurationBehavior ViewModel="{Binding ViewModel, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </local:MediaControls.Behavior>
                        </TextBlock>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Margin="10,0,10,10">
                        <local:SignalStrength x:Name="SignalStrength" Value="{Binding SignalStrength}" Margin="10,0,0,0" VerticalAlignment="Center" Visibility="{Binding IsSignalStrengthVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}"/>
                        <local:ResolutionIndicator x:Name="ResolutionIndicator" MediaQuality="{Binding MediaQuality}" VerticalAlignment="Center" Margin="10,0,10,0" Visibility="{Binding IsResolutionIndicatorVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibleIfConverter}}"/>
                    </StackPanel>

                </Grid>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="local:ControlPanel">
        <Setter Property="Background" Value="{StaticResource PhoneSemitransparentColor}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="TransportBarButtonStyle" Value="{StaticResource TransportBarButtonStyle}"/>
        <Setter Property="TransportBarTextButtonStyle" Value="{StaticResource TransportBarTextButtonStyle}"/>
        <Setter Property="PrimaryButtonStyle" Value="{StaticResource PrimaryButtonStyle}"/>
        <Setter Property="Template" Value="{StaticResource ControlPanelTemplate}"/>
    </Style>

    <Style TargetType="local:MediaPlayer">
        <Setter Property="InteractiveDeactivationMode" Value="All"/>
        <Setter Property="AutoHideBehavior" Value="All"/>
        <Setter Property="IsTimeRemainingVisible" Value="False"/>
        <Setter Property="IsDurationVisible" Value="True"/>
        <!--<Setter Property="SkipBackInterval" Value="00:00:07"/>-->
        <Setter Property="ControlPanelTemplate" Value="{StaticResource ControlPanelTemplate}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MediaPlayer">
                    <Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FullScreenStates">
                                <VisualState x:Name="FullScreen"/>
                                <VisualState x:Name="NotFullScreen"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CaptionsStates">
                                <VisualState x:Name="CaptionsActive">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="CaptionsContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CaptionsInactive"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="AdvertisingStates">
                                <VisualState x:Name="LoadingAd">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.5" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MediaContainer"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="LoadingAdvertisment">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsIndeterminate" Storyboard.TargetName="AdvertisementLoadingProgressBar">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="LinearAd">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MediaContainer"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NonLinearAd">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MediaContainer"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NoAd">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MediaContainer"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="InteractiveStates">
                                <VisualState x:Name="StartInteracting">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="InteractivityContainer">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="InteractivityContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="StopInteracting">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="InteractivityContainer">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="InteractivityContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Visible">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="InteractivityContainer" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="InteractivityContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Hidden">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="InteractivityContainer"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="InteractivityContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="MediaStates">
                                <VisualState x:Name="Opening">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="BufferingContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Paused"/>
                                <VisualState x:Name="Playing"/>
                                <VisualState x:Name="Closed"/>
                                <VisualState x:Name="Buffering">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="BufferingContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="PlayerStates">
                                <VisualState x:Name="Unloaded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="PosterContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pending">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="LoaderViewContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="PosterContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Loading"/>
                                <VisualState x:Name="Loaded"/>
                                <VisualState x:Name="Opened"/>
                                <VisualState x:Name="Starting"/>
                                <VisualState x:Name="Started"/>
                                <VisualState x:Name="Ending"/>
                                <VisualState x:Name="Failed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Visibility)" Storyboard.TargetName="ErrorsContainer">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="MediaContainer">
                            <Grid x:Name="CaptionsContainer" Visibility="Collapsed" IsHitTestVisible="False"/>
                        </Grid>
                        <Grid x:Name="PosterContainer" Visibility="Collapsed" IsHitTestVisible="False"/>
                        <Grid x:Name="AdvertisingContainer" Visibility="Collapsed">
                            <Grid x:Name="LoadingAdvertisment" Background="#00000000" Visibility="Collapsed">
                                <ProgressBar x:Name="AdvertisementLoadingProgressBar" IsIndeterminate="False" VerticalAlignment="Center"  HorizontalAlignment="Stretch"/>
                            </Grid>
                        </Grid>
                        <Grid x:Name="ErrorsContainer" Visibility="Collapsed"/>
                        <Grid x:Name="InteractivityContainer" Visibility="Collapsed">
                            <local:ControlPanel x:Name="ControlPanel" ViewModel="{TemplateBinding InteractiveViewModel}"
                                IsGoLiveButtonVisible="{TemplateBinding IsGoLiveVisible}"
                                IsInfoButtonVisible="{TemplateBinding IsInfoVisible}"
                                IsMoreButtonVisible="{TemplateBinding IsMoreVisible}"
                                IsAudioSelectionButtonVisible="{TemplateBinding IsAudioSelectionVisible}"
                                IsCaptionSelectionButtonVisible="{TemplateBinding IsCaptionSelectionVisible}"
                                IsTimeElapsedButtonVisible="{TemplateBinding IsTimeElapsedVisible}"
                                IsDurationButtonVisible="{TemplateBinding IsDurationVisible}"
                                IsTimeRemainingButtonVisible="{TemplateBinding IsTimeRemainingVisible}"
                                IsFastForwardButtonVisible="{TemplateBinding IsFastForwardVisible}"
                                IsStopButtonVisible="{TemplateBinding IsStopVisible}"
                                IsRewindButtonVisible="{TemplateBinding IsRewindVisible}"
                                IsSkipPreviousButtonVisible="{TemplateBinding IsSkipPreviousVisible}"
                                IsSkipNextButtonVisible="{TemplateBinding IsSkipNextVisible}"
                                IsSkipBackButtonVisible="{TemplateBinding IsSkipBackVisible}"
                                IsSkipAheadButtonVisible="{TemplateBinding IsSkipAheadVisible}"
                                IsReplayButtonVisible="{TemplateBinding IsReplayVisible}"
                                IsResolutionIndicatorVisible="{TemplateBinding IsResolutionIndicatorVisible}"
                                IsSignalStrengthVisible="{TemplateBinding IsSignalStrengthVisible}"
                                IsFullScreenButtonVisible="{TemplateBinding IsFullScreenVisible}"
                                IsSlowMotionButtonVisible="{TemplateBinding IsSlowMotionVisible}"
                                IsPlayPauseButtonVisible="{TemplateBinding IsPlayPauseVisible}"
                                IsVolumeButtonVisible="{TemplateBinding IsVolumeVisible}"
                                IsZoomButtonVisible="{TemplateBinding IsZoomVisible}"
                                IsTimelineVisible="{TemplateBinding IsTimelineVisible}"/>
                        </Grid>
                        <Grid x:Name="LoaderViewContainer" Visibility="Collapsed"/>
                        <Grid x:Name="BufferingContainer" Visibility="Collapsed"/>
                        <Grid x:Name="SettingsContainer" Visibility="Collapsed"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:LoaderView">
        <Setter Property="Background" Value="#00000000"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:LoaderView">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="1" Grid.Row="1" MaxHeight="150" MaxWidth="150" Style="{StaticResource PrimaryButtonStyle}" x:Name="LoadButton">
                            <TextBlock FontFamily="Segoe UI Symbol" FontSize="26" Text="&#xE102;"/>
                        </Button>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ErrorView">
        <Setter Property="Background" Value="{StaticResource PhoneSemitransparentColor}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ErrorView">
                    <Grid Background="{TemplateBinding Background}">
                        <StackPanel VerticalAlignment="Center">
                            <TextBlock Text="{TemplateBinding ErrorText}" FontSize="30" HorizontalAlignment="Center"/>
                            <Button Style="{StaticResource PrimaryButtonStyle}" Width="100" Height="100" Margin="0,20,0,12" x:Name="RetryButton">
                                <TextBlock FontFamily="Segoe UI Symbol" FontSize="26" Text="&#xE102;"/>
                            </Button>
                            <TextBlock x:Name="RetryInstructions" Text="{TemplateBinding RetryText}" FontSize="30" HorizontalAlignment="Center"/>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:BufferingView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:BufferingView">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="MediaStates">
                                <VisualState x:Name="Opening">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsIndeterminate" Storyboard.TargetName="ProgressIndicator">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ProgressIndicator">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.01" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Paused"/>
                                <VisualState x:Name="Playing"/>
                                <VisualState x:Name="Closed"/>
                                <VisualState x:Name="Buffering">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsIndeterminate" Storyboard.TargetName="ProgressIndicator">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <sys:Boolean>True</sys:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ProgressIndicator">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.01" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ProgressBar x:Name="ProgressIndicator" IsIndeterminate="False" Visibility="Collapsed" IsHitTestVisible="False"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:CaptionSelectorView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CaptionSelectorView">
                    <Grid x:Name="LayoutRoot" Background="#00000000">
                        <Border Background="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <local:DeselectableListBox x:Name="CaptionsList" Foreground="{StaticResource PhoneBackgroundBrush}" Margin="10" FontSize="{StaticResource PhoneFontSizeLarge}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:AudioSelectionView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AudioSelectionView">
                    <Grid x:Name="LayoutRoot" Background="#00000000">
                        <Border Background="{StaticResource PhoneForegroundBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <ListBox x:Name="AudioList" ItemsSource="{Binding AvailableAudioStreams}" SelectedItem="{Binding SelectedAudioStream, Mode=TwoWay}"
                                     Foreground="{StaticResource PhoneBackgroundBrush}" Margin="10" FontSize="{StaticResource PhoneFontSizeLarge}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:PosterView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PosterView">
                    <Grid Background="#00000000">
                        <Image x:Name="ImageElement"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
